class GeoLocationField {
    initOptions(field) {
        field.options = [
            { label: "位置类型", value: "point" },
            { label: "经度字段", value: "latitude" },
            { label: "纬度字段", value: "longitude" },
            { label: "几何字段", value: "geom" },
        ];
    }
    getOptionsHtml(field) {
        let fieldOptions1 = FormConfigManager.getFieldSelectOptions(field.options?.[1]?.value || 'latitude');
        let fieldOptions2 = FormConfigManager.getFieldSelectOptions(field.options?.[2]?.value || 'longitude');
        let fieldOptions3 = FormConfigManager.getFieldSelectOptions(field.options?.[3]?.value || 'geom');
        let html = `
          <div class="form-group">
            <label>位置类型</label>
            <select id="fieldLocationType">
              <option value="point" ${(field.options?.[0]?.value || '经纬度') === 'point' ? "selected" : ""}>经度+纬度</option>
              <option value="geom" ${(field.options?.[0]?.value || '经纬度') === 'geom' ? "selected" : ""}>根据Geom字段</option>
            </select>
          </div>
          <div class="form-group">
            <label>经度字段</label>
            <select id="fieldLatitude">
              ${fieldOptions1}
            </select>
          </div>
          <div class="form-group">
            <label>纬度字段</label>
            <select id="fieldLongitude">
              ${fieldOptions2}
            </select>
          </div>
          <div class="form-group">
            <label>几何字段</label>
            <select id="fieldGeom">
              ${fieldOptions3}
            </select>
          </div>
        `;
        return html;
    }
    collectOptionSettings(field) {
        field.options[0].value = document.getElementById('fieldLocationType').value;
        field.options[1].value = document.getElementById('fieldLatitude').value;
        field.options[2].value = document.getElementById('fieldLongitude').value;
        field.options[3].value = document.getElementById('fieldGeom').value;
    }
}
export default new GeoLocationField();